package com.atguigu.yygh.order.listener;

import com.atguigu.yygh.model.order.OrderInfo;
import com.atguigu.yygh.mq.MqConst;
import com.atguigu.yygh.mq.RabbitService;
import com.atguigu.yygh.order.mapper.OrderInfoMapper;
import com.atguigu.yygh.order.service.OrderInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author mgx
 * @version 1.0
 * @description: TODO
 * @date 2022/9/11 0:54
 */
@Component
public class OrderReceiver {

    @Autowired
    private RabbitService rabbitService;

    @Autowired
    private OrderInfoService orderInfoService;


    @RabbitListener(bindings = {
            @QueueBinding(
                    value = @Queue(name = MqConst.QUEUE_TASK_8, durable = "true"),
                    exchange = @Exchange(name = MqConst.EXCHANGE_DIRECT_TASK, durable = "true"),
                    key = MqConst.ROUTING_TASK_8
            )
    })
    public void consume(){
        // 调用service层提示用户
        orderInfoService.patientRemind();
    }
}
